package community.hospital.service.domain.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import community.hospital.entity.RoleMenuRelation;
import community.hospital.service.domain.RoleMenuRelationService;
import community.hospital.mapper.RoleMenuRelationMapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
* @author ydj
* @description 针对表【role_menu_relation】的数据库操作Service实现
* @createDate 2023-01-17 19:26:23
*/
@Service
public class RoleMenuRelationServiceImpl extends ServiceImpl<RoleMenuRelationMapper, RoleMenuRelation>
    implements RoleMenuRelationService{

    @Override
    public List<RoleMenuRelation> listByRoleId(Long roleId) {
        return lambdaQuery().eq(RoleMenuRelation::getRoleId, roleId).list();
    }

    @Override
    public Boolean removeByRoleIds(List<Long> roleIds) {
        LambdaQueryChainWrapper<RoleMenuRelation> wrapper = lambdaQuery().in(RoleMenuRelation::getRoleId, roleIds);
        return this.remove(wrapper);
    }

    @Override
    public Boolean removeByRoleId(Long id) {
        LambdaQueryChainWrapper<RoleMenuRelation> wrapper = lambdaQuery().eq(RoleMenuRelation::getRoleId, id);
        return remove(wrapper);
    }

}




